home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / dsp / dr.bub / 96000.lha / 96000 / appb / b140a.asm < prev    next >
Assembly Source File  |  1992-04-28  |  3KB  |  53 lines

  1. ; This program was originally published in the Motorola DSP96002 Users Manual
  2. ; and is provided under a DISCLAIMER OF WARRANTY available from Motorola DSP
  3. ; Operation, 6501 William Cannon Drive West, Austin, Texas 78735-8598.  For
  4. ; more information, refer to the DSP96002 Users Manual, Appendix B, DSP
  5. ; Benchmarks.
  6. ;
  7. ; B.1.40    Graphics BITBLT (Bit Block Transfer)  
  8. ;The bit block transfer (BITBLT) is an operation that transfers  a bit field from one area of memory to 
  9. ;another.  Four parameters  describe the BITBLT operation:  
  10. ;SOURCE - The source address of the block to be transferred.  Data transferred from  the source 
  11. ;starts at the lsb of the first data word.  
  12. ;COUNT    -     The number of words to transfer from the source field.  This must be  greater than zero.  
  13. ;DEST       -     Destination starting address.  
  14. ;OFFSET   -     The starting bit number of the destination word that the transfer is to  start.  The offset 
  15. ;is in the range of 0-31.  
  16. ;Note that the source data starts at the lsb of the first word whereas  the destination starts at an ar-
  17. ;bitrary offset from the lsb.  
  18. ; B.1.40.1    32 Bit Block Transfer  
  19. ;              32 Bit Block Transfer                         Program    ICycles 
  20. ;                     BITBLT                                 Words 
  21.        org   x:0 
  22. source ds      1      ;source address 
  23. dest   ds      1      ;destination address 
  24. offset ds      1      ;bit number start (0-31) 
  25. count  ds      1      ;number of 32 bit source words 
  26.  
  27.   org  p:$50 
  28.   move          x:offset,d0.l ;get output bit position         2     2 
  29.   move          #32,d1.l      ;get 32                          1     1 
  30.   sub  d0,d1    x:source,r0   ;32-offset, point to source      2     2 
  31.   move          x:dest,r1     ;point to destination address    2     2 
  32.   move          d1.l,d1.h     ;move shift factor               1     1 
  33.   move          y:(r1),d4.l   ;get first bits of dest          1     1 
  34.   lsl  d1,d4    d0.l,d0.h     ;shift bits, move shift fact     1     1 
  35.   move          x:count,n0    ;get source word count           2     2 
  36.  
  37.   do   n0,bitblt              ;do transfer                     2     3 
  38.   lsr  d1,d4    y:(r0)+,d5.l  ;shift old bits, get source bits 1     1 
  39.   lsl  d0,d5    d5.l,d3.l     ;shift new bits, save new bits   1     1 
  40.   or   d4,d5    d3.l,d4.l     ;merge bits, save new as old bit 1     1 
  41.   move          d5.l,y:(r1)+  ;save new dest field             1     1 
  42. bitblt 
  43.   lsr  d1,d4    y:(r1),d5.l   ;shift old bits, get dest bits   1     1 
  44.   lsr  d0,d5                  ;shift dest bits                 1     1 
  45.   lsl  d0,d5                  ;shift dest bits back            1     1 
  46.   or   d4,d5                  ;part of dest with source bits   1     1 
  47.   move          d5.l,y:(r1)   ;save new destination bits       1     1 
  48.                                                          ;     ---   --- 
  49.                                                      ; Totals: 24   4N+20 
  50.  
  51. ;Where N represents 32 bits transferred.  At a 13.5 MIPS, a total of  (13.5/4)*32 = 108 
  52. ;MBits/Second transfer rate is possible.  
  53.